<template>
  <div class="recordCss">
    <div class="titleCss">查看记分类型表</div>
    <div class="bodyCss">
      <div class="tableBtnCss">
        <el-button type="primary" @click="addBtn">添加</el-button>
      </div>
      <div class="tableCss">
        <el-table
          max-height="560"
          :data="tableData"
          border
          style="width: 100%">
          <el-table-column
            type="index"
            label="序号"
            width="55"
            align="center">
          </el-table-column>
          <el-table-column
            prop="data1"
            label="记分数值"
            width="80">
          </el-table-column>
          <el-table-column
            prop="data2"
            label="记分原因"
            min-width="320">
          </el-table-column>
        </el-table>
        <el-pagination
          style="margin-top:10px;text-align: right;"
          :pageSize="pageSize"
          layout="prev, pager, next"
          :page-sizes="[10, 20, 50]"
          :total="total"
          @sizeChange="handleSizeChange"
          @currentChange="handleCurrentChange">
        </el-pagination>
      </div>
    </div>
    <div class="bottomBtnCss">
      <el-button @click="goBackBtn">返回</el-button>
    </div>
  </div>
</template>

<script>
export default {
  props:{
    pageType:{
      type: Number,
      default:()=> 1,
    }
  },
  data(){
    return{
      tableData:[],
      pageSize:10,
      total:1000,
    }
  },
  mounted(){
    this.getList()
  },
  methods:{
    addBtn(){
      const obj = {
        path: `/healthCare/${this.pageType === 1 ? 'zpMedicalOrgScoring' : 'zpMedicalOrgPhysicianScoring'}/sortDetail/typeDetail/addDetail`,
        query: {
          id: '111',
        }
      }
      this.$router.push(obj);
    },
    handleCurrentChange(){
      
    },
    handleSizeChange(){
      
    },
    goBackBtn(){
      this.$router.back()
    },
    getList(){
      const random = Math.floor( Math.random() * 30) + 20
      let list = []
      for( let i=0;i<random;i++){
        const random1 = Math.floor( Math.random() * 100) + 1
        list.push({
          data1: `${random1}分`,
          data2: '【测试数据】买卖、出借或者转让标有医疗机构标识的票据、病历本册或者处方笺、各种检查的申请单、报告单、证明文书单、药品分装袋、制剂标签等',
        })
      }
      this.tableData = list
    },
  },
}
</script>

<style lang="scss" scoped>
.recordCss{
  overflow: hidden;
  position: relative;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  height: calc( 100vh - 66px - 40px);
  display: flex;
  flex-direction: column;
  .titleCss{
    text-align: center;
    font-size: 24px;
    font-weight: bold;
  }
  .bodyCss{
    margin-top: 20px;
    margin-left: 20px;
    width: calc( 100% - 10px);
    padding-right: 40px;
    overflow-y: auto;
    height: calc( 100% - 90px);
    padding-bottom: 20px;
    .tableCss{
      padding-bottom: 20px;
      margin-top: 20px;
    }
  }
  .bottomBtnCss{
    margin-top: auto;
    text-align: right;
  }
}
</style>